﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Hydra.Shell.Attributes;
using System.Collections.Generic;
using Hydra.Shell.Enumerations;
using Hydra.Shell.Implementations;

namespace Hydra.Shell.Interfaces
{
    [GuidAttribute("B61FC35B-EEBF-4DEC-BFF1-28A2DD43C38F")]
    public interface IHydraUIShell : IQueryServiceProvider, IServiceProvider, IUnknown
    {
        IEnumerable<IHydraWindowFrame> GetToolWindows();
        IEnumerable<IHydraWindowFrame> GetDocumentWindows();
        bool FindToolWindow(HydraFindToolWindow grfFTW, ref Guid rguidPersistenceSlot, out IHydraWindowFrame ppWindowFrame);
        bool CreateToolWindow(HydraCreateToolWindow grfCTW, uint dwToolWindowId, object punkTool, ref Guid rclsidTool, ref Guid rguidPersistenceSlot, ref Guid rguidAutoActivate, IQueryServiceProvider psp, string pszCaption, int[] pfDefaultPosition, out IHydraWindowFrame ppWindowFrame);
        bool CreateDocumentWindow(HydraCreateDocWindow grfCDW, string pszMkDocument, IHydraUIHierarchy pUIH, uint itemid, IUnknown punkDocView, IUnknown punkDocData, ref Guid rguidEditorType, string pszPhysicalView, ref Guid rguidCmdUI, IQueryServiceProvider psp, string pszOwnerCaption, string pszEditorCaption, int[] pfDefaultPosition, out IHydraWindowFrame ppWindowFrame);
        bool SetErrorInfo(int hr, string pszDescription, uint dwReserved, string pszHelpKeyword, string pszSource);
        bool ReportErrorInfo(int hr);
        bool GetDialogOwnerHwnd(out UIElement phwnd);
        bool EnableModeless(bool fEnable);
        bool SaveDocDataToFile(HydraSaveFlags grfSave, object pPersistFile, string pszUntitledPath, out string pbstrDocumentNew, out bool pfCanceled);
        bool SetupToolbar(UIElement hwnd, IHydraToolWindowToolbar ptwt, out IHydraToolWindowToolbarHost pptwth);
        bool SetForegroundWindow();
        bool TranslateAcceleratorAsACmd(Key[] pMsg);
        bool UpdateCommandUI(bool fImmediateUpdate);
        bool UpdateDocDataIsDirtyFeedback(uint docCookie, bool fDirty);
        bool RefreshPropertyBrowser(int dispid);
        bool SetWaitCursor();
        bool PostExecCommand(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, ref object pvaIn);
        bool ShowContextMenu(uint dwCompRole, ref Guid rclsidActive, int nMenuId, Point[] pos, ICommandTarget pCmdTrgtActive);
        bool ShowMessageBox(uint dwCompRole, ref Guid rclsidComp, string pszTitle, string pszText, string pszHelpFile, uint dwHelpContextID, MessageButton msgbtn, MessageDefaultButton msgdefbtn, MessageIcon msgicon, bool fSysAlert, out Hydra.Shell.Enumerations.MessageBoxResult pnResult);
        bool SetMRUComboText(ref Guid pguidCmdGroup, uint dwCmdID, string lpszText, int fAddToList);
        bool SetToolbarVisibleInFullScreen(Guid[] pguidCmdGroup, uint dwToolbarId, int fVisibleInFullScreen);
        bool FindToolWindowEx(uint grfFTW, ref Guid rguidPersistenceSlot, uint dwToolWinId, out IHydraWindowFrame ppWindowFrame);
        bool GetAppName(out string pbstrAppName);
        bool GetVSSysColor(HydraSysColor dwSysColIndex, out uint pdwRGBval);
        bool SetMRUComboTextW(Guid[] pguidCmdGroup, uint dwCmdID, string pwszText, int fAddToList);
        bool PostSetFocusMenuCommand(ref Guid pguidCmdGroup, uint nCmdID);
        bool GetCurrentBFNavigationItem(out IHydraWindowFrame ppWindowFrame, out string pbstrData, out object ppunk);
        bool AddNewBFNavigationItem(IHydraWindowFrame pWindowFrame, string bstrData, object punk, int fReplaceCurrent);
        bool OnModeChange(DebugMode dbgmodeNew);
        bool GetErrorInfo(out string pbstrErrText);
        bool GetOpenFileNameViaDlg(HydraOpenFileName[] pOpenFileName);
        bool GetSaveFileNameViaDlg(HydraSaveFileName[] pSaveFileName);
        bool GetDirectoryViaBrowseDlg(HydraBrowseInfo[] pBrowse);
        bool CenterDialogOnWindow(IntPtr hwndDialog, IntPtr hwndParent);
        bool GetPreviousBFNavigationItem(out IHydraWindowFrame ppWindowFrame, out string pbstrData, out IUnknown ppunk);
        bool GetNextBFNavigationItem(out IHydraWindowFrame ppWindowFrame, out string pbstrData, out IUnknown ppunk);
        bool GetURLViaDlg(string pszDlgTitle, string pszStaticLabel, string pszHelpTopic, out string pbstrURL);
        bool RemoveAdjacentBackForthNavigationItem(RemoveBackForthDirection rdDir);
        bool RemoveCurrentNavigationDupes(RemoveBackForthDirection rdDir);

        // Implementation V2

        bool GetOpenFileNameViaDlgEx(HydraOpenFileName[] pOpenFileName, string pszHelpTopic);
        bool GetSaveFileNameViaDlgEx(HydraSaveFileName[] pSaveFileName, string pszHelpTopic);
        bool GetDirectoryViaBrowseDlgEx(HydraBrowseInfo[] pBrowse, string pszHelpTopic, string pszOpenButtonLabel, string pszCeilingDir, HydraNamespaceExtensionBrowseInfo[] pNSEBrowseInfo);
        bool SaveItemsViaDlg(uint cItems, HydraSaveTreeItem[] rgSaveItems);
        bool GetVSSysColorEx(int dwSysColIndex, out uint pdwRGBval);
        bool CreateGradient(uint GRADIENTTYPE, out IHydraGradient pGradient);
        bool GetVSCursor(uint cursor, out IntPtr phIcon);
        bool IsAutoRecoverSavingCheckpoints(out int pfARSaving);
        bool HydraDialogBoxParam(uint hinst, uint dwId, uint lpDialogFunc, int lp);
        bool CreateIconImageButton(IntPtr hwnd, IntPtr hicon, uint bwiPos, out IHydraImageButton ppImageButton);
        bool CreateGlyphImageButton(IntPtr hwnd, ushort chGlyph, int xShift, int yShift, uint bwiPos, out IHydraImageButton ppImageButton);

        // Implementation V3

        bool ReportErrorInfo2(int hr, bool Suppress);
        bool SuppressRestart(bool Suppress);

        // Implementation V4

        IEnumerable<IHydraWindowFrame> GetWindows(uint type);
        bool SetupToolbar2(UIElement hwnd, IHydraToolWindowToolbar ptwt, ICommandTarget pCmdTarget, out IHydraToolWindowToolbarHost pptwth);
        bool SetupToolbar3(IHydraWindowFrame pFrame, out IHydraToolWindowToolbarHost pptwth);
        bool CreateToolbarTray(ICommandTarget pCmdTarget, out IHydraToolbarTrayHost ppToolbarTrayHost);
    }
}